﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Content;

namespace InversPong.Model
{
    /// <summary>
    /// The base class of all game objects.
    /// </summary>
    public abstract class Object
    {
        /// <summary>
        /// Position of the object (given in tiles).
        /// </summary>
        public Vector2 Position { get; set; }

        public int Width { get; set; }

        public int Height { get; set; }

        public String GfxName { get; set; }

        public float Scale { get; set; }

        public Rectangle BoundingBox 
        { 
            get
            {
                return new Rectangle((int)Position.X, (int)Position.Y, (int)Scale * Width, (int)Scale * Height);
            }
        }
        /// <summary>
        /// Creates a copy of the object.
        /// </summary>
        public virtual Object Copy() { return (Object)this.MemberwiseClone(); }

        public Object() { 
        
        }

        public Object(Vector2 position, String gfxName, int width, int height)
        {
            Position = position;
            GfxName = gfxName;
            Width = width;
            Height = height;
            Scale = 1;
        }

        public virtual Texture2D LoadTexture(ContentManager contentManager)
        {
            return contentManager.Load<Texture2D>("gfx\\" + GfxName);
        }
    }
}